//
//  TNTravelNotesDetailsModel.m
//  TravelNotes
//
//  Created by 王浩宇 on 15/8/12.
//  Copyright (c) 2015年 王浩宇. All rights reserved.
//

#import "TNTravelNotesDetailsModel.h"

@implementation TNTravelNotesDetailsModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        _userModel = [[TNUserModel alloc] init];
        _notesLikesCommModel = [[TNNotesLikesCommentsModel alloc] init];
        _tipModel = [[TNTipModel alloc] init];
//        _tripDaysModel = [[TNTripDaysModel alloc] init];
        _tripDaysArray = [[NSMutableArray alloc] init];
    }
    return self;
}


- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }else if ([key isEqualToString:@"notes_likes_comments"]){
        [self.notesLikesCommModel setValuesForKeysWithDictionary:value];
    }else if ([key isEqualToString:@"tip"]){
        [self.tipModel setValuesForKeysWithDictionary:value];
    }else if ([key isEqualToString:@"trip_days"]){
        for (NSDictionary *dict in value) {
            TNTripDaysModel *tripDayModel = [[TNTripDaysModel alloc] init];
            [tripDayModel setValuesForKeysWithDictionary:dict];
            [self.tripDaysArray addObject:tripDayModel];
        }
    }else if ([key isEqualToString:@"user"]){
        [self.userModel setValuesForKeysWithDictionary:value];
    }
    
    
}

@end
